<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // 封装一个数学对象，里面有PI，求数组得最大值和最小值
        let myMath={
            PI:3.14,
            getMax:function(arr){
                let max=arr[0];
                for(let index in arr){
                    if(arr[index]>max){
                        max=arr[index];
                    }
                }
                return max;
            },
            getMin:function(arr){
                let min=arr[0];
                for(let index in arr){
                    if(arr[index]>min){
                        min=arr[index];
                    }
                }
                return min;
            },
        }

        console.log(myMath.PI);
        let arr=[34,34,53,66,34,2];
        console.log(myMath.getMax(arr));
        console.log(myMath.getMin(arr));
    </script>
</body>
</html>